package com.leon.biuvideo.greendao.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.leon.biuvideo.greendao.dao.DownloadHistory;
import com.leon.biuvideo.greendao.dao.DownloadLevelOne;
import com.leon.biuvideo.greendao.dao.SearchHistory;

import com.leon.biuvideo.greendao.dao.DownloadHistoryDao;
import com.leon.biuvideo.greendao.dao.DownloadLevelOneDao;
import com.leon.biuvideo.greendao.dao.SearchHistoryDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig downloadHistoryDaoConfig;
    private final DaoConfig downloadLevelOneDaoConfig;
    private final DaoConfig searchHistoryDaoConfig;

    private final DownloadHistoryDao downloadHistoryDao;
    private final DownloadLevelOneDao downloadLevelOneDao;
    private final SearchHistoryDao searchHistoryDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        downloadHistoryDaoConfig = daoConfigMap.get(DownloadHistoryDao.class).clone();
        downloadHistoryDaoConfig.initIdentityScope(type);

        downloadLevelOneDaoConfig = daoConfigMap.get(DownloadLevelOneDao.class).clone();
        downloadLevelOneDaoConfig.initIdentityScope(type);

        searchHistoryDaoConfig = daoConfigMap.get(SearchHistoryDao.class).clone();
        searchHistoryDaoConfig.initIdentityScope(type);

        downloadHistoryDao = new DownloadHistoryDao(downloadHistoryDaoConfig, this);
        downloadLevelOneDao = new DownloadLevelOneDao(downloadLevelOneDaoConfig, this);
        searchHistoryDao = new SearchHistoryDao(searchHistoryDaoConfig, this);

        registerDao(DownloadHistory.class, downloadHistoryDao);
        registerDao(DownloadLevelOne.class, downloadLevelOneDao);
        registerDao(SearchHistory.class, searchHistoryDao);
    }
    
    public void clear() {
        downloadHistoryDaoConfig.clearIdentityScope();
        downloadLevelOneDaoConfig.clearIdentityScope();
        searchHistoryDaoConfig.clearIdentityScope();
    }

    public DownloadHistoryDao getDownloadHistoryDao() {
        return downloadHistoryDao;
    }

    public DownloadLevelOneDao getDownloadLevelOneDao() {
        return downloadLevelOneDao;
    }

    public SearchHistoryDao getSearchHistoryDao() {
        return searchHistoryDao;
    }

}
